package com.lingyue.entity.module.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lingyue.entity.deserializer.DateDeserializer;
import com.lingyue.entity.groups.Modify;
import com.lingyue.entity.module.biz.entity.OpportunitiesItemEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author BaiJinhua
 * @since 2019-11-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ApiOpportunitiesEntity对象", description="线索信息api")
@TableName("api_opportunities")
public class ApiOpportunitiesEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(groups = Modify.class)
    @ApiModelProperty(value = "主键id", hidden = true)
    @TableId(value = "API_OPT_ID", type = IdType.AUTO)
    private Long id;

    @NotBlank(message = "unique_key not be empty")
    @ApiModelProperty(value = "数据唯一键")
    @JsonProperty("unique_key")
    @TableField("API_OPT_UNIQUE_KEY")
    private String uniqueKey;

    @NotNull(message = "dealer_id require not be empty")
    @ApiModelProperty(value = "经销商id")
    @JsonProperty("dealer_id")
    @TableField("API_OPT_DEL_ID")
    private Long delId;

    @NotBlank(message = "vin require not be empty")
    @ApiModelProperty(value = "车架号")
    @JsonProperty("vin")
    @TableField("API_OPT_VIN")
    private String vin;

    @NotBlank(message = "campaign_code require not be empty")
    @ApiModelProperty(value = "活动code")
    @JsonProperty("campaign_code")
    @TableField("API_OPT_CODE")
    private String code;

    @NotBlank(message = "campaign_name require not be empty")
    @ApiModelProperty(value = "活动name")
    @JsonProperty("campaign_name")
    @TableField("API_OPT_NAME")
    private String name;

    @ApiModelProperty(value = "活动背景")
    @JsonProperty("campaign_background")
    @TableField("API_OPT_TEXT")
    private String text;

    @ApiModelProperty(value = "金融密文")
    @JsonProperty("sf_combined")
    @TableField("API_OPT_SF_COMBINED")
    private String sfCombined;

    @NotNull(message = "due_date require not be empty")
    @ApiModelProperty(value = "过期时间")
    @JsonProperty("due_date")
    @TableField("API_OPT_DUE_DATE")
    private LocalDate dueDate;

    @ApiModelProperty(value = "线索状态（E-expired/D-default/1-去他店/2-回本店）")
    @JsonProperty("leads_status")
    @TableField("API_OPT_LEADS_STATUS")
    @Pattern(regexp = "^E|D|1|2$", message = "leads_status is invalid")
    private String leadsStatus;

    @ApiModelProperty(value = "Teleservice ticket id. Only present for tele service campaign.")
    @JsonProperty("ticket_id")
    @TableField("API_OPT_TICKET_ID")
    private String ticketId;

    @ApiModelProperty(value = "远程单创建时间")
    @JsonProperty("ticket_creation_date")
    @TableField("API_OPT_TICKET_CREATION_DATE")
    @JsonDeserialize(using = DateDeserializer.class)
    private LocalDateTime ticketCreationDate;

    @ApiModelProperty(value = "vhc/tssb线索明细",hidden = true)
    @TableField("API_OPT_CAMPAIGN_ITEMS")
    private String campaignItems;

    @ApiModelProperty(value = "vhc/tssb线索明细数组")
    @JsonProperty("campaign_items")
    @TableField(exist = false)
    @Valid
    private List<OpportunitiesItemEntity> campaignItemsArray;

    @ApiModelProperty(value = "tssb Whether to arrive at the shop within 70 days(Y/N)")
    @JsonProperty("arrival_status")
    @TableField("API_OPT_ARRIVAL_STATUS")
    @Pattern(regexp = "^$|Y|N$", message = "arrival_status is invalid")
    private String arrivalStatus;

    @ApiModelProperty(value = "开单后返本店时间")
    @JsonProperty("back_the_dealer_date")
    @TableField("API_OPT_BACK_THE_DEALER_DATE")
    @JsonDeserialize(using = DateDeserializer.class)
    private LocalDateTime backTheDealerDate;

    @ApiModelProperty(value = "开单后返他店时间")
    @JsonProperty("back_other_dealer_date")
    @TableField("API_OPT_BACK_OTHER_DEALER_DATE")
    @JsonDeserialize(using = DateDeserializer.class)
    private LocalDateTime backOtherDealerDate;

    @ApiModelProperty(value = "转换时间")
    @JsonProperty("convert_date")
    @TableField("API_OPT_CONVERT_DATE")
    @JsonDeserialize(using = DateDeserializer.class)
    private LocalDateTime convertDate;

    @JsonProperty("reserve_1")
    @TableField("API_OPT_RESERVE01")
    private String reserve01;

    @JsonProperty("reserve_2")
    @TableField("API_OPT_RESERVE02")
    private String reserve02;

    @JsonProperty("reserve_3")
    @TableField("API_OPT_RESERVE03")
    private String reserve03;

    @JsonProperty("reserve_4")
    @TableField("API_OPT_RESERVE04")
    private String reserve04;

    @JsonProperty("reserve_5")
    @TableField("API_OPT_RESERVE05")
    private String reserve05;

    @JsonProperty("reserve_6")
    @TableField("API_OPT_RESERVE06")
    private String reserve06;

    @JsonProperty("reserve_7")
    @TableField("API_OPT_RESERVE07")
    private String reserve07;

    @JsonProperty("reserve_8")
    @TableField("API_OPT_RESERVE08")
    private String reserve08;

    @JsonProperty("reserve_9")
    @TableField("API_OPT_RESERVE09")
    private String reserve09;

    @JsonProperty("reserve_10")
    @TableField("API_OPT_RESERVE10")
    private String reserve10;

    @ApiModelProperty(value = "数据源")
    @TableField("API_OPT_DATA_SOURCE")
    private String dataSource;

    @ApiModelProperty(value = "处理逻辑", hidden = true)
    @TableField("API_OPT_HANDLER_FLAG")
    private String handlerFlag;

    @ApiModelProperty(value = "请求流水号")
    @TableField("API_OPT_REQUEST_NO")
    private String requestNo;

    @TableField("API_OPT_CREATE_DATE")
    private LocalDateTime createDate;

    @TableField("API_OPT_CREATE_USER")
    private String createUser;

    @ApiModelProperty(value = "消费状态：init-初始化、finished-完成")
    @TableField("API_OPT_CONSUME_FLAG")
    private String consumeFlag;


    public static final String API_OPT_ID = "API_OPT_ID";

    public static final String API_OPT_UNIQUE_KEY = "API_OPT_UNIQUE_KEY";

    public static final String API_OPT_DEL_ID = "API_OPT_DEL_ID";

    public static final String API_OPT_VIN = "API_OPT_VIN";

    public static final String API_OPT_CODE = "API_OPT_CODE";

    public static final String API_OPT_NAME = "API_OPT_NAME";

    public static final String API_OPT_TEXT = "API_OPT_TEXT";

    public static final String API_OPT_SF_COMBINED = "API_OPT_SF_COMBINED";

    public static final String API_OPT_DUE_DATE = "API_OPT_DUE_DATE";

    public static final String API_OPT_LEADS_STATUS = "API_OPT_LEADS_STATUS";

    public static final String API_OPT_TICKET_ID = "API_OPT_TICKET_ID";

    public static final String API_OPT_TICKET_CREATION_DATE = "API_OPT_TICKET_CREATION_DATE";

    public static final String API_OPT_CAMPAIGN_ITEMS = "API_OPT_CAMPAIGN_ITEMS";

    public static final String API_OPT_ARRIVAL_STATUS = "API_OPT_ARRIVAL_STATUS";

    public static final String API_OPT_BACK_THE_DEALER_DATE = "API_OPT_BACK_THE_DEALER_DATE";

    public static final String API_OPT_BACK_OTHER_DEALER_DATE = "API_OPT_BACK_OTHER_DEALER_DATE";

    public static final String API_OPT_CONVERT_DATE = "API_OPT_CONVERT_DATE";

    public static final String API_OPT_RESERVE01 = "API_OPT_RESERVE01";

    public static final String API_OPT_RESERVE02 = "API_OPT_RESERVE02";

    public static final String API_OPT_RESERVE03 = "API_OPT_RESERVE03";

    public static final String API_OPT_RESERVE04 = "API_OPT_RESERVE04";

    public static final String API_OPT_RESERVE05 = "API_OPT_RESERVE05";

    public static final String API_OPT_RESERVE06 = "API_OPT_RESERVE06";

    public static final String API_OPT_RESERVE07 = "API_OPT_RESERVE07";

    public static final String API_OPT_RESERVE08 = "API_OPT_RESERVE08";

    public static final String API_OPT_RESERVE09 = "API_OPT_RESERVE09";

    public static final String API_OPT_RESERVE10 = "API_OPT_RESERVE10";

    public static final String API_OPT_DATA_SOURCE = "API_OPT_DATA_SOURCE";

    public static final String API_OPT_HANDLER_FLAG = "API_OPT_HANDLER_FLAG";

    public static final String API_OPT_REQUEST_NO = "API_OPT_REQUEST_NO";

    public static final String API_OPT_CONSUME_FLAG = "API_OPT_CONSUME_FLAG";

    public static final String API_OPT_CREATE_DATE = "API_OPT_CREATE_DATE";

    public static final String API_OPT_CREATE_USER = "API_OPT_CREATE_USER";

}
